package com.shop.cereshop.commons.domain.wallet;

import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 代理商钱包流水表
 * </p>
 *
 * @since 2025-11-14
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@TableName("cere_agent_wallet_transaction")
@ApiModel(value = "CereAgentWalletTransaction", description = "代理商钱包流水表")
@AllArgsConstructor
@Builder
public class CereAgentWalletTransaction {

  private static final long serialVersionUID = 1L;

  /**
   * 流水ID
   */
  @ApiModelProperty(value = "流水ID")
  @NotNull(message = "流水ID不能为空")
  @TableId(value = "transaction_id", type = IdType.AUTO)
  private Long transactionId;

  /**
   * 代理商ID
   */
  @ApiModelProperty(value = "代理商ID")
  @NotNull(message = "代理商ID不能为空")
  @TableField("agent_user_id")
  private Long agentUserId;

  /**
   * 交易类型 1-充值 2-消费 3-提现 4-代理商任务奖励 5-业务员任务奖励 6-代理商邀请分润 7-代理地区分润 8-业务员邀请商家奖励
   * 9-业务员邀请用户奖励 10-带营解冻 11-股东池奖励
   */
  @ApiModelProperty(value = "交易类型 1-充值 2-消费 3-提现 4-代理商任务奖励 5-业务员任务奖励 6-代理商邀请分润 7-代理地区分润 8-业务员邀请商家奖励 9-业务员邀请用户奖励 10-带营解冻 11-股东池奖励")
  @NotNull(message = "交易类型不能为空")
  @TableField("transaction_type")
  private Integer transactionType;

  /**
   * 交易金额
   */
  @ApiModelProperty(value = "交易金额")
  @NotNull(message = "交易金额不能为空")
  @TableField("amount")
  private BigDecimal amount;

  /**
   * 交易前余额
   */
  @ApiModelProperty(value = "交易前余额")
  @NotNull(message = "交易前余额不能为空")
  @TableField("balance_before")
  private BigDecimal balanceBefore;

  /**
   * 交易后余额
   */
  @ApiModelProperty(value = "交易后余额")
  @NotNull(message = "交易后余额不能为空")
  @TableField("balance_after")
  private BigDecimal balanceAfter;

  /**
   * 关联目标id(充值关联充值记录id，消费关联订单id，提现关联提现记录id，任务奖励关联任务id，代理商邀请代理商不需要关联，代理分润关联分润记录id，奖励都不需要关联)
   */
  @ApiModelProperty(value = "关联目标id")
  @TableField("target_id")
  private Long targetId;

  /**
   * 交易描述
   */
  @ApiModelProperty(value = "交易描述")
  @NotEmpty(message = "交易描述不能为空")
  @Length(max = 100, message = "交易描述长度不能超过100")
  @TableField(value = "description", condition = LIKE)
  private String description;

  /**
   * 备注
   */
  @ApiModelProperty(value = "备注")
  @Length(max = 500, message = "备注长度不能超过500")
  @TableField(value = "remark", condition = LIKE)
  private String remark;

  /**
   * 创建时间
   */
  @ApiModelProperty(value = "创建时间")
  @NotNull(message = "创建时间不能为空")
  @TableField("create_time")
  private LocalDateTime createTime;

  /**
   * 角色类型 1-代理商，2-业务员
   */
  @ApiModelProperty(value = "角色类型 1-代理商，2-业务员")
  @NotNull(message = "角色类型不能为空")
  @TableField("role_type")
  private Integer roleType;

}
